package com.bite.configdemo.facade;

// 采用门面模式
public class FacadeLight {
    private Light[] lights = new Light[]{
            new BashroomLight(),
            new BedroomLight(),
            new LivingroomLight()
    };

    // 开所有的灯
    public void onAllLight() {
        for (int i = 0; i < lights.length; i++) {
            lights[i].on();
        }
    }

    // 关所有的灯
    public void offAllLight() {
        for (int i = 0; i < lights.length; i++) {
            lights[i].off();
        }
    }
}
